<template>
  <div  ref="test" style="box-sizing: border-box;padding-bottom: 200px;position: relative;">
    <div @click="getTop"  :style="!$store.state.addSwitch?'opacity: 1;left:0;':'opacity: 0'" id='addSwitch'>
      <h3>发动态</h3>
      <div style="width: 18px;height: 18px;border-radius: 50%;border: 1px solid white;display: flex;justify-content: center;align-items: center">
        <i class="el-icon-plus"></i>
      </div>
    </div>
    <div v-if="$store.state.addSwitch" id="dynamicAdd1">
      <AddDynamic ref="addDynamic"></AddDynamic>
    </div>
    <Dynamic ref="dynamic"></Dynamic>
  </div>
</template>

<script>
import AddDynamic from "../../../components/content/AddDynamic";
import Dynamic from "../../../components/content/Dynamic";

export default {
  components: {
    AddDynamic, Dynamic
  },
  data(){
    return{
        
    }
  },

  methods:{
    getData(){
      this.$refs.dynamic.getData()
    },
    getTop(){
      this.$parent.toTop()
    }
  },

}

</script>

<style scoped>
#addSwitch{
  cursor: pointer;
  color: #f6eaea;
  background: rgba(0,0,0,.3);
  width: 100px;
  height: 30px;
  position:sticky;
  z-index: 12;
  top: 0;
  left: 200px;
  justify-content: space-around;
  align-items: center;
  display: flex;
  border-radius: 0px 15px 15px 0;
  transition: all .4s;
  opacity: 1;
}
#addSwitch2{
  cursor: pointer;
  color: #f6eaea;
  background: rgba(0,0,0,.3);
  width: 100px;
  height: 30px;
  position:sticky;
  z-index: 10;
  top: 0;
  justify-content: space-around;
  align-items: center;
  display: flex;
  border-radius: 0px 15px 15px 0;
  transition: background-color .3s;

}
#addSwitch:hover{
  background: rgba(0,0,0,.6);
}
#addSwitch *{
  margin: 0;
}
#switch{
  width: 100%;
  display: flex;
  justify-content: center;
  cursor: pointer;
}
#switch:hover{
  background-color: rgba(0,0,0,.2);
}
#dynamicAdd1{
  transition: margin-top .2s ease-in;
  display: flex;
  margin-top: -40px;
  flex-direction: column;
  align-items: center;
}
#dynamicAdd2{
  /*margin-top: -30px;*/
  transition: margin-top .2s ease-out;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.black{
  color: black;
}
.gray{
  color: gainsboro;
}
.fade2-enter-active, .fade2-leave-active {
  transition: all .5s;
  transition-delay: 0s;
}
.fade2-enter, .fade2-leave-to /* .fade-leave-active below version 2.1.8 */ {
  transform: translate(0px,-300px);
}
.fade-enter-active, .fade-leave-active {
  transition: all .5s;
}
.fade-enter, .fade-leave-to /* .fade-leave-active below version 2.1.8 */ {
  transform: translate(0px,-300px);
}
.dynamic{
  margin-bottom: 20px;
  width: 100%;
  box-shadow: 0 0px 5px grey;
  background-color: #fff;
}
header{
  height: 70px;
  width: 100%;
  display: flex;

}
#avatar{
  height:100%;
  width: 11%;
  /*border-radius: 50%;*/
  display: flex;
  justify-content: center;
  align-items: center;
  /*background-color: #000;*/
}
#avatar img{
  width: 60px;
  height: 60px;
  border-radius: 50%;
}
#user{
  color: rgb(51,51,51);
  width: 89%;
  height: 100%;
  display: flex;
  justify-content:space-between;
}
#user h3:hover{
  color: red;
  cursor: pointer;
}
#user *{
  padding: 0;
  margin: 0;
}
#user p{
  font-size: 13px;
}
article{
  display: flex;
  flex-direction: row;
}
#blank{
  display: flex;
  width: 11%;

  /*background-color: #000;*/
}
footer{
  height: 35px;
  width: 100%;
  border-top: 1px solid #e7d7d7;
  display: flex;
  justify-content: space-between;
  position: relative;
}
#comment{
  box-sizing: border-box;
  padding: 10px 0;
  top: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: absolute;
  z-index: 5;
  width: 100%;
  box-shadow:0 2px 2px grey;
  background-color: #eee3e3;
}
#myComment{
  display: flex;
  width: 90%;
  height: 40px;
  justify-content: space-between;
}
#myComment img{
  height: 100%;
}
.otherComment{
  height: 50px;
  width: 90%;
  display: flex;
  margin: 10px 0;
}
.otherComment *{
  margin: 0;
}
.otherComment img{
  height: 100%;
}
.fBtn{
  cursor:pointer;
  width: 25%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  color: rgb(128,128,128);
  font-size: 15px;
}
.fBtn i{
  font-size: 18px;
}
#content{
  width: 80%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

@media screen and (max-width: 500px){
  .dynamic{
    height: 100px;
    width: 95vw;
    box-sizing: border-box;
    display: flex;
    padding: 10px;
  }
  .dynamic h3{
    font-size: 16px;
  }
  .dynamic p{
    font-size: 8px;
  }
  footer{
    font-size: 8px;
  }
  #add{
    width: 130vw;
  }
}
</style>